package com.supor.aiot.home.utils;

import android.view.View;
import android.widget.ImageView;

import com.supor.aiot.home.R;

import androidx.databinding.BindingAdapter;

/**
 * ---------------------------------------------------------------- <br>
 * Copyright (C) 2014-2021, by het, ShenZhen, All rights reserved.  <br>
 * ---------------------------------------------------------------- <br>
 * <p>
 * 描述: BindingUtils <br>
 * 作者: lei <br>
 * 日期: 2021/8/10 <br>
 */
public class BindingUtils {

    @BindingAdapter("android:imgStatus")
    public static void showStatusImg(ImageView imageView, int status) {
        imageView.setVisibility(View.VISIBLE);
        if (status == 0) {
            imageView.setVisibility(View.GONE);
        } else if (status == 1) {
            imageView.setImageResource(R.mipmap.ic_status_power_off);
        } else if (status == 2) {
            imageView.setImageResource(R.mipmap.ic_status_standby);
        } else if (status == 3) {
            imageView.setImageResource(R.mipmap.ic_status_on);
        } else if (status == 4) {
            imageView.setImageResource(R.mipmap.ic_status_off);
        }
    }
}
